<template>
    <div class="panel minh_624">
        <div class="item_title pr">
            积分记录
        </div>
        <div>
            <div class="myPoints__main">
                <div class="myPoints__main__info">
                    <p>您当前的积分：<span class="ac_list__status">{{infoData.u_integral}}</span></p>
                </div>
            </div>
            <div class="pointsLog__main__table">
                <el-table :data="listData.data" border style="width: 100%">
                    <el-table-column prop="m_create_time" label="时间" width="180" align="center"></el-table-column>
                    <el-table-column prop="m_title" label="积分来源" align="center"></el-table-column>
                    <el-table-column prop="m_content" label="详细说明" align="center"></el-table-column>
                </el-table>
                <!-- 分页 -->
                <div class="text-right">
                    <el-pagination layout="prev, pager, next" :total="listData.total" @current-change="listPage" style="margin: 20px 0px 0px;"></el-pagination>
                </div>
            </div>
        </div>
    </div>
</template>
<script>

    export default {
        data(){
            return{
                infoData: {},
                listData: {},
                page: 1,
            }
        },
        methods: {
            init(){

                var _this = this;
                //个人信息     获取积分
                this.$httpGet('/api/index/Personal_center/enterpriseInfo',{
                    'u_id': window.localStorage.uid,
                }).then(response => {
                    
                    if(response.code == 200){

                        _this.infoData = response.msg;
                        
                    }else{
                        this.$message({
                            message: response.msg,
                            type: 'warning'
                        });
                    }

                });
                
            },
            list(){
                var _this = this;
                //积分列表
                this.$httpGet('/api/index/Login/getUserPointsList',{
                    'u_id': window.localStorage.uid,
                    'page': _this.page,
                }).then(response => {
                    
                    if(response.code == 200){

                        _this.listData = response.msg;
                        
                    }else{
                        this.$message({
                            message: response.msg,
                            type: 'warning'
                        });
                    }

                });
            },
            //切换页码
            listPage(page){
                this.page = page;
                this.list();
            },
        },
        mounted(){
            this.init();
            this.list();
        },
    }
</script>
